package com.meisupic.copyright.domain.po;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicUpdate;

/**
 * @Author wuxun
 * @Date 2018/1/25 下午5:10
 */
@Data
@Entity
@Table(name = "copyright_message")
@DynamicUpdate
public class Message {

  @Id
  @GeneratedValue
  private Long id;

  @Column(name = "works_id", nullable = false)
  private Long worksId;

  /**
   * 消息标题
   */
  @Column(name="title", nullable = false)
  private String title;

  /**
   * 消息内容
   */
  @Column(name = "content", nullable = false)
  private String content;

  /**
   * 是否已读
   */
  @Column(name = "readed",nullable = false,columnDefinition = "bit(1) default 0")
  private boolean readed;

  /**
   * 接收人id
   */
  @Column(name = "receiver_id",nullable = false)
  private Long receiverId;

  /**
   * 创建时间
   */
  @Column(name = "create_time", nullable = false)
  @CreationTimestamp()
  private Date createTime;
}
